<%@ page import="java.util.List" %>
<%@ page import="top.huhuiyu.study.javawebjdbc.entity.TbMovie" %>
<%@ page import="top.huhuiyu.study.javawebjdbc.dao.TbMovieDAO" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
  <title>Title</title>
  <link rel="stylesheet" href="../lib/bootstarp.min.css">
</head>
<body>
<%
  List<TbMovie> list = TbMovieDAO.query();
%>

<div style="padding: 1rem;">

  <div>
    <a class="btn btn-primary" href="insert.jsp">发布电影信息</a>
  </div>

  <div>电影列表</div>

  <table class="table table-hover table-striped table-bordered">

  <thead>
  <tr class="text-bg-success">
    <th>编号</th>
    <th>电影名称</th>
    <th>电影简介</th>
    <th>电影评分</th>
    <th>上映时间</th>
    <th>操作</th>
  </tr>
  </thead>

  <tbody>
  <%
    for (TbMovie movie : list) {
  %>
  <tr>
    <td><%=movie.getId()%></td>
    <td><%=movie.getMovie()%></td>
    <td><%=movie.getInfo()%></td>
    <td><%=movie.getScore()%></td>
    <td><%=movie.getCreated()%></td>
    <td>
      <a class="btn btn-danger btn-sm" href="delete.jsp?id=<%=movie.getId()%>">删除</a>
    </td>
  </tr>
  <%
    }
  %>
  </tbody>


</table>

</div>

<script src="../lib/bootstarp.min.js"></script>
</body>
</html>
